package com.prj.ufdm.cloud.ms.core.enums;

/**
 *
 * 日志的请求状态
 *
 * @author: zhujq
 * @date: 2019/9/23 17:29
 */
public enum LogStatusEnum {
    /**
     * 成功
     */
    SUCCESS("1", "成功"),
    /**
     * 失败
     */
    FAILURE("2", "失败"),
    /**
     * 锁住
     */
    LOCK("3", "用户被锁住");

    private String code;

    private String label;

    public static String getLabelByCode(int code){
        String label = "";
        for (LogStatusEnum logStatusEnum : LogStatusEnum.values()) {
            if(logStatusEnum.code.equals(code)){
                label = logStatusEnum.label;
            }
        }
        return label;
    }

    public static String getCodeBylabel(String label){
        String code = null;
        for (LogStatusEnum logStatusEnum : LogStatusEnum.values()) {
            if(logStatusEnum.label.equalsIgnoreCase(label)){
                code = logStatusEnum.code;
            }
        }
        return code;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    LogStatusEnum(String code, String label) {
        this.code = code;
        this.label = label;
    }
}
